<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>考试管理</title>
    <link rel="shortcut icon" href="../../static/favicon.ico"
          th:href="@{/static/favicon.ico}">
    <link href="../../static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"
          th:href="@{/static/css/bootstrap.min.css(v=3.3.6) }">
    <link href="../../static/css/font-awesome.css?v=4.4.0" rel="stylesheet"
          th:href="@{/static/css/font-awesome.css(v=4.4.0) }">
    <link href="../../static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"
          th:href="@{/static/css/plugins/bootstrap-table/bootstrap-table.min.css }">
    <link href="../../static/css/animate.css" rel="stylesheet"
          th:href="@{/static/css/animate.css }">
    <link href="../../static/css/style.css?v=4.1.0" rel="stylesheet"
          th:href="@{/static/css/style.css(v=4.1.0) }">
    <!--Bootstrap表格插件-->
    <link href="../../static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"
          th:href="@{/static/css/plugins/bootstrap-table/bootstrap-table.min.css }">
    <!--滑动按钮-->
    <link href="../../static/css/plugins/switchery/switchery.css"
          th:href="@{/static/css/plugins/switchery/switchery.css}" rel="stylesheet">
    <!--时间控件-->
    <link href="../../static/public/user/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"
          th:href="@{/static/public/user/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"
          rel="stylesheet">
    <!-- 弹出框插件 -->
    <link href="../../static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet"
          th:href="@{/static/css/plugins/sweetalert/sweetalert.css }">
    <style type="text/css">
        /* 表格样式 */
        .table > thead > tr > th {
            text-align: center;
            color: #2a62bc;
        }

        .table > tbody > tr > td {
            text-align: center;
        }


        #isTestRecords #testRecords_form .col-md-2, #lackTestRecords_form .col-md-2, #examManagementForm .col-md-2, #examManagementForm .col-md-4 {
            padding-left: 0px;
            padding-right: 8px;
        }

        #isTestRecords .col-md-5 {
            padding: 0;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-title">
        <div class="row row-lg">
            <!--**************************************非考试记录部分***************************************-->
            <div class="col-sm-12" id="noIsTestRecords" style="display: block">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active" id="allStu"><a data-toggle="tab" href="#tab-1" aria-expanded="true">我的考试</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <!--创建考试、考试管理按钮-->
                                <p style="color: #aaa">考试用于将考试按规则安排给特定考生进行作答并查看批改结果，请在以下列表中管理您创建的考试</p>
                                <div>
                                    <button type="button" onclick="switchover('add')" class="btn btn-white"
                                            title="创建考试">创建考试
                                    </button>
                                    <button type="button" class="btn btn-success" title="考试管理">考试管理</button>
                                </div><!--END---创建考试、考试管理按钮-->
                                <!--创建考试-->
                                <div id="createTestPaper" class="panel panel-default"
                                     style="margin-top: 10px;display: none">
                                    <!--填写考试基本信息-->
                                    <div class="panel-heading">
                                        <h4> 基本信息&nbsp;&nbsp;&nbsp;
                                            <small style="font-size: 13px;"> 填写考试基本信息</small></h4>
                                    </div>
                                    <div class="panel-body">
                                        <form method="get" class="form-horizontal col-md-10" id="createTestPaper_1">
                                            <!--考试名称-->
                                            <div class="form-group">
                                                <label class="col-md-2 control-label">
                                                    考试名称</label>
                                                <div class="col-md-10">
                                                    <input type="text" name="testPaperName" class="form-control">
                                                </div>
                                            </div> <!--END--考试名称-->
                                            <!--考试分类、考试状态-->
                                            <div class="form-group">
                                                <!--考试分类-->
                                                <label class=" control-label col-md-2">
                                                    考试分类</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="classification"
                                                               class="form-control classification"
                                                               placeholder="分类" style="border-color:#f8ac59">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-success">
                                                                <i class="glyphicon glyphicon-plus"></i>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--考试状态-->
                                                <label class="col-md-2 control-label">
                                                    考试状态</label>
                                                <div class="col-md-4">
                                                    <input type="checkbox" name="startUsing"
                                                           class=" form-control js-switch-notable "/>
                                                </div>
                                            </div><!--END--考试分类、考试状态-->
                                            <!--设置考试、及格分数-->
                                            <div class="form-group">
                                                <!--设置考试-->
                                                <label class=" control-label col-md-2">
                                                    设置考试</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="setTestPaper"
                                                               class="form-control"
                                                               placeholder="请选择考试">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-success">
                                                                <i class="glyphicon glyphicon-search"></i>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--及格分数-->
                                                <label class=" control-label col-md-2">
                                                    及格分数</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="passMark" class="form-control"
                                                               placeholder="60" aria-describedby="basic-addon2">
                                                        <span class="input-group-addon"
                                                              id="basic-addon2">考试总分 : <a>0</a></span>
                                                    </div>
                                                </div>
                                            </div><!--END--设置考试、及格分数-->
                                            <!--考试排序、考试展示-->
                                            <div class="form-group">
                                                <!--试题排序-->
                                                <label class=" control-label col-md-2">
                                                    试题排序</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="trySorting"
                                                               class="form-control trySorting"
                                                               placeholder="固定排序">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--考试排序-->
                                                <label class=" control-label col-md-2">
                                                    考试展示</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="tryShow"
                                                               class="form-control tryShow"
                                                               placeholder="整卷展示">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div> <!--END--考试排序、考试展示-->
                                            <!--选项随机、可考次数-->
                                            <div class="form-group">
                                                <!--选项随机-->
                                                <label class=" control-label col-md-2">
                                                    选项随机</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="optionRandom"
                                                               class="form-control optionRandom"
                                                               placeholder="固定排序">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--可考次数-->
                                                <label class=" control-label col-md-2">
                                                    可考次数</label>
                                                <div class="col-md-4">
                                                    <input type="text" name="canTestTimes" class="form-control">
                                                </div>
                                            </div> <!--END--选项随机、可考次数-->
                                            <!--考试须知-->
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">
                                                    考试须知</label>
                                                <div class="col-sm-10">
                                                    <textarea class="form-control" name="testInstructions"
                                                              rows="4"></textarea>
                                                </div>
                                            </div> <!--END--考试须知-->
                                        </form>
                                    </div><!--END--填写考试基本信息-->
                                    <!--填写考试时间安排-->
                                    <div class="panel-heading">
                                        <h4> 时间设置&nbsp;&nbsp;&nbsp;
                                            <small style="font-size: 13px;"> 填写考试时间安排</small></h4>
                                    </div>
                                    <div class="panel-body">
                                        <form method="get" class="form-horizontal col-md-10" id="createTestPaper_2">
                                            <!--开考时间、结束时间-->
                                            <div class="form-group ">
                                                <!--开考时间-->
                                                <label class=" control-label col-md-2">
                                                    开考时间</label>
                                                <div class="col-md-4">
                                                    <input type="text" class="form-control datapicker"
                                                           name="startTime"/>
                                                </div>
                                                <!--结束时间-->
                                                <label class="col-md-2 control-label">
                                                    结束时间</label>
                                                <div class="col-md-4">
                                                    <input type="text" class="form-control datapicker" name="endTime"/>
                                                </div>
                                            </div> <!--END--开考时间、结束时间-->
                                            <!--考试时长、公布成绩-->
                                            <div class="form-group">
                                                <!--考试时长-->
                                                <label class=" control-label col-md-2">
                                                    考试时长</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" class="form-control"
                                                               name="testTime">
                                                        <span class="input-group-addon" id="testTime">分钟</span>
                                                    </div>
                                                </div>
                                                <!--公布成绩-->
                                                <label class=" control-label col-md-2">
                                                    公布成绩</label>
                                                <div class="col-md-4">
                                                    <input type="text" class="form-control datapicker"
                                                           name="releaseTime"/>
                                                </div>
                                            </div><!--END--考试时长、公布成绩-->
                                            <!--参加限制、交卷限制-->
                                            <div class="form-group">
                                                <!--参加限制-->
                                                <label class=" control-label col-md-2">
                                                    参加限制</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">考试开始</span>
                                                        <input type="text" name="toLimit" class="form-control"
                                                               placeholder="0">
                                                        <span class="input-group-addon">分钟后禁止参加考试</span>
                                                    </div>
                                                </div>
                                                <!--交卷限制-->
                                                <label class=" control-label col-md-2">
                                                    交卷限制</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">开始考试</span>
                                                        <input type="text" name="submitLimit" class="form-control"
                                                               placeholder="0">
                                                        <span class="input-group-addon">分钟内不允许交卷</span>
                                                    </div>
                                                </div>
                                            </div> <!--END--参加限制、交卷限制-->
                                            <!--公布答案、查看详情-->
                                            <div class="form-group">
                                                <!--公布答案-->
                                                <label class=" control-label col-md-2">
                                                    公布答案</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="announcedAnswer"
                                                               class="form-control announcedAnswer"
                                                               placeholder="不公布答案(公布成绩后，不公布正确答案)">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--查看详情-->
                                                <label class=" control-label col-md-2">
                                                    查看详情</label>
                                                <div class="col-md-4">
                                                    <div class="input-group">
                                                        <input type="text" name="checkDetails"
                                                               class="form-control checkDetails"
                                                               placeholder="允许 考生查看历史答卷详情">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div> <!--END--公布答案、查看详情-->
                                        </form>
                                    </div>
                                    <!--填设置考试对象-->
                                    <div class="panel-heading">
                                        <h4> 考试对象&nbsp;&nbsp;&nbsp;
                                            <small style="font-size: 13px;"> 设置参加考试的目标班级或学生</small></h4>
                                    </div>
                                    <div class="panel-body">
                                        <form method="get" class="form-horizontal col-md-10" id="createTestPaper_3">
                                            <div class="form-group">
                                                <label class="col-md-2 control-label">
                                                    考试班级</label>
                                                <div class="col-md-10">
                                                    <div id="testClassGroup">
                                                    </div>
                                                    <button type="button" class="btn btn-success"
                                                            id="testClassGroup_add" title="添加">添加
                                                    </button>
                                                    <button type="button" class="btn btn-danger"
                                                            id="testClassGroup_deleteAll" title="清空">清空
                                                    </button>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-md-2 control-label">
                                                    考试学生</label>
                                                <div class="col-md-10">
                                                    <div id="testStudentGroup">
                                                    </div>
                                                    <button type="button" class="btn btn-success"
                                                            id="testStudentGroup_add" title="添加">添加
                                                    </button>
                                                    <button type="button" class="btn btn-danger"
                                                            id="testStudentGroup_deleteAll" title="清空">清空
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                    </div><!--END--填设置考试对象-->
                                    <!--提交和重新填写的两个按钮-->
                                    <div class="col-md-offset-7" style="padding: 10px">
                                        <button type="button" class="btn btn-success add">提交</button>
                                        <button type="button" class="btn btn-danger reset">重新填写</button>
                                    </div><!--END--提交和重新填写的两个按钮-->
                                </div><!--END---创建考试-->
                                <!--考试管理-->
                                <div id="topicManagement">
                                    <!--右上角form表单-->
                                    <div id="toolbar">
                                        <form class="form-inline" id="examManagementForm">
                                            <!-- 考试名称-->
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <div class="input-group ">
                                                        <input type="text" name="testPaperName"
                                                               class="form-control testPaperName"
                                                               placeholder="考试名称">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--状态-->
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <div class="input-group ">
                                                        <input type="text" name="state" class="form-control state"
                                                               placeholder="状态">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--分类-->
                                            <div class="col-md-2">
                                                <div class="form-group ">
                                                    <div class="input-group">
                                                        <input type="text" name="classification"
                                                               class="form-control classification"
                                                               placeholder="分类">
                                                        <div class="input-group-btn">
                                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                                    data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <div class="input-group">
                                                        <input type="text" class="form-control datapicker"
                                                               name="startTime"
                                                               placeholder="开始时间"/>
                                                        <span class="input-group-addon">到</span>
                                                        <input type="text" class="form-control datapicker"
                                                               name="endTime"
                                                               placeholder="结束时间"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--查询按钮-->
                                            <button class="btn btn-success query" type="button">查询</button>
                                        </form>
                                    </div><!--END--右上角form表单-->
                                    <table class="tb_departments"></table>
                                </div> <!--END---考试管理-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--**************************************考试记录部分***************************************-->
            <div class="col-md-12" id="isTestRecords" style="display: none">
                <div class="header">
                    <div class="col-md-6">
                        <h2><strong>考试记录</strong></h2>
                    </div>
                    <div class="col-md-6">
                        <button class="btn btn-white refresh" style="float: right;margin-left: 5px">刷新</button>
                        <button class="btn btn-white getBack" style="float: right">返回</button>
                    </div>
                    <div class="col-md-12" style="margin-top: 8px;color: #aaa"><p>从以下列表查看和管理考生的答卷记录</p></div>
                    <div class="col-md-7">
                        <table class="table table-bordered cephalosome" style="margin-top: 10px">
                            <tr>
                                <td style="background: #e6e6e6">考试名称</td>
                                <td><a class="testPaperName_1">1</a></td>
                            </tr>
                            <tr>
                                <td style="background: #e6e6e6">考试时间</td>
                                <td><a class="startTime">2020-06-08 14:16:00</a>至<a class="endTime">2020-06-09
                                    00:00:00</a> </a></td>
                            </tr>
                            <tr>
                                <td style="background: #e6e6e6">考试时长</td>
                                <td><a class="testTime">12 分钟</a></td>
                            </tr>
                            <tr>
                                <td style="background: #e6e6e6">卷面总分</td>
                                <td><a class="totalPoints">100.0</a>分 (及格分: <a class="passMark">60.0</a>)</a></td>
                            </tr>
                        </table>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-7" style="padding: 0">
                            <form id="testRecords_form">
                                <div class=" col-md-2">
                                    <input type="text" name="keyword" class="form-control" placeholder="关键字">
                                </div>
                                <div class=" col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control examineeGroup" name="examineeGroup"
                                               placeholder="考生组">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                    data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                        <!-- /btn-group -->
                                    </div>
                                </div>
                                <div class=" col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control duty" name="duty" placeholder="职务">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                    data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                        <!-- /btn-group -->
                                    </div>
                                </div>
                                <div class=" col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control sortord" name="sortord"
                                               placeholder="交卷时间从早到晚">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                    data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                        <!-- /btn-group -->
                                    </div>
                                </div>
                                <div class=" col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control show" name="show" placeholder="显示全部答案">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-white dropdown-toggle"
                                                    data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                        <!-- /btn-group -->
                                    </div>
                                </div>
                                <div class=" col-md-2">
                                    <button class="btn btn-success query" type="button">查询</button>
                                </div>
                            </form>
                        </div>
                        <div class="col-md-5">
                            <div style="float: right">
                                <button class="btn btn-success" title="将考生成绩导出为EXCEL"><i class="fa fa-file-excel-o"></i></button>
                                <button class="btn btn-danger" title="导出所有考生答卷"><i class="fa fa-file-zip-o"></i></button>
                                <button class="btn btn-info" title="查看缺考名单"><i class="fa fa-user-times"></i></button>
                                <button class="btn btn-primary" title="重新批改所有考生答卷"><i class="fa fa-pencil-square-o"></i></button>
                                <button class="btn btn-warning" title="快速批改主观题"><i class="fa fa-clone"></i></button>
                                <button class="btn btn-default" title="清空考生答卷"><i class="fa fa-exclamation-triangle"></i></button>
                            </div>
                            <div class="col-md-4" style="float: right; padding: 6px;margin-right: 6px">
                                <div title="点我刷新">
                                    <div class="progress progress-striped active">
                                        <div style="width: 100%" aria-valuemax="100" aria-valuemin="0"
                                             aria-valuenow="75" role="progressbar" class="progress-bar">
                                            <a>100.00%</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div style="float: right; padding: 6px">
                                进度:
                            </div>
                        </div>
                        <table id="tb_departments_1"></table>
                    </div>

                </div>
            </div>

        </div>
    </div>
</div>
</div>
<!--预览考试的模态框-->
<div class="modal  fade" id="modal_1" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">考试预览</h4>
            </div>
            <div class="modal-body">
                <form method="get" class="form-horizontal" id="form_toView">
                    <div class="form-group">
                        <label class="col-sm-2 control-label ">
                            考试名称</label>
                        <div class="col-sm-8">
                            <input type="text" name="testPaperName" disabled="" class="form-control testPaperName_1"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            考试状态</label>
                        <div class="col-sm-8">
                            <input type="text" name="state" disabled="" class="form-control state_1 " placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            管理权限</label>
                        <div class="col-sm-8">
                            <input type="text" name="adminPermissions" disabled=""
                                   class="form-control adminPermissions_1" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            考试总分</label>
                        <div class="col-sm-8">
                            <input type="text" name="totalScore" disabled=""
                                   class="form-control totalScore" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            章节设置</label>
                        <div class="col-sm-8">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <strong>章节名称：</strong><a class="nameSection"></a>
                                </div>
                                <table class="table table-bordered">
                                    <tr>
                                        <td>题库</td>
                                        <td>题型</td>
                                        <td>难度</td>
                                        <td>题目数量</td>
                                        <td>单题分值</td>
                                    </tr>
                                    <tr>
                                        <td><a class="questionBank"></a></td>
                                        <td><a class="topic"></a></td>
                                        <td><a class="difficulty"></a></td>
                                        <td><a class="titleNumber"></a></td>
                                        <td><a class="singleTopicScore"></a></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--*********************************考试记录部分*************************************-->
<!--查看缺考名单的模态框-->
<div class="modal  fade " id="modal_2" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">缺考名单</h4>
            </div>
            <div class="modal-body">
                <form id="lackTestRecords_form">
                    <div class=" col-md-2">
                        <input type="text" name="keyword" class="form-control" placeholder="关键字">
                    </div>
                    <div class=" col-md-2">
                        <div class="input-group">
                            <input type="text" class="form-control examineeGroup" name="examineeGroup"
                                   placeholder="考生组">
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-white dropdown-toggle"
                                        data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                </ul>
                            </div>
                            <!-- /btn-group -->
                        </div>
                    </div>
                    <div class=" col-md-2">
                        <div class="input-group">
                            <input type="text" class="form-control duty" name="duty" placeholder="职务">
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-white dropdown-toggle"
                                        data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                </ul>
                            </div>
                            <!-- /btn-group -->
                        </div>
                    </div>
                    <div class=" col-md-2">
                        <button class="btn btn-success query" type="button">查询</button>
                    </div>
                </form>
                <button class="btn btn-white" style="float: right" title="导出缺考名单">导出名单</button>
                <div style="margin-top: 30px">
                    <table id="tb_departments_2"></table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--选择班级的模态框-->
<div class="modal  fade" id="modal_3" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">选择班级</h4>
            </div>
            <div class="modal-body">
                <p style="color: #aaa">从下面的列表勾选参加考试的班级</p>
                <table id="tb_departments_3"></table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success bulkInsert" data-dismiss="modal">批量插入</button>
            </div>
        </div>
    </div>
</div>
<!--选择学生的模态框-->
<div class="modal  fade" id="modal_4" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">选择学生</h4>
            </div>
            <div class="modal-body">
                <p style="color: #aaa">从下面的列表勾选参加考试的学生</p>
                <table id="tb_departments_4"></table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success bulkInsert" data-dismiss="modal">批量插入</button>
            </div>
        </div>
    </div>
</div>
<!--选择试卷的模态框-->
<div class="modal  fade" id="modal_5" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">选择试卷</h4>
            </div>
            <div class="modal-body">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#myPaper" aria-expanded="true">我的试卷</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#sharedPaper" aria-expanded="false">共享试卷</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="myPaper" class="tab-pane active">
                            <div class="panel-body">
                                <p style="color: #aaa">从下面我的试卷中选择考试的内容</p>
                                <table id="tb_departments_5"></table>
                            </div>
                        </div>
                        <div id="sharedPaper" class="tab-pane">
                            <div class="panel-body">
                                <p style="color: #aaa">从下面共享试卷中选择考试的内容</p>
                                <table id="tb_departments_6"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<!-- 全局js -->
<script src="../../static/js/jquery.min.js?v=2.1.4"
        th:src="@{/static/js/jquery.min.js(v=2.1.4) }"></script>
<script src="../../static/js/bootstrap.min.js?v=3.3.6"
        th:src="@{/static/js/bootstrap.min.js(v=3.3.6) }"></script>
<!-- 自定义js -->
<script src="../../static/js/content.js?v=1.0.0"
        th:src="@{/static/js/content.js(v=1.0.0) }"></script>
<!--Bootstrap表格插件 -->
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/bootstrap-table.min.js }"></script>
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js }"></script>
<script src="../../static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js }"></script>
<!--滑动按钮-->
<script src="../../static/js/plugins/switchery/switchery.js"
        th:src="@{/static/js/plugins/switchery/switchery.js}"></script>
<!--动态搜索-->
<script src="../../static/js/plugins/suggest/bootstrap-suggest.min.js"
        th:src="@{/static/js/plugins/suggest/bootstrap-suggest.min.js}"></script>
<script src="../../static/public/user/bsSuggest.js"
        th:src="@{/static/public/user/bsSuggest.js }"></script>
<!-- 时间控件 -->
<script src="../../static/public/user/bootstrap-datetimepicker/bootstrap-datetimepicker.js"
        th:src="@{/static/public/user/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js}"></script>
<script src="../../static/public/user/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
        th:src="@{/static/public/user/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js}"></script>
<script src="../../static/public/user/timeAllocation.js"
        th:src="@{/static/public/user/timeAllocation.js }"></script>
<!-- 弹出框插件 -->
<script src="../../static/js/plugins/sweetalert/sweetalert.min.js"
        th:src="@{/static/js/plugins/sweetalert/sweetalert.min.js }"></script>
<!--自定义js---表格操作-->
<script src="../../static/public/exam/tableOperation.js"
        th:src="@{/static/public/exam/tableOperation.js}"></script>
<!-- layui -->
<script src="../../static/public/user/layui-v2.5.6/layui/layui.all.js"
        th:src="@{/static/public/user/layui-v2.5.6/layui/layui.all.js}"></script>
<!--***************************************非考试记录部分***************************************-->
<!--滑动按钮初始化、创建考试按钮监听-->
<script>
    $(function () {
        switchForNoTable();
    });

    let checked_notable = false;
    let switchery_notable;

    /* 初始化非表单滑动按钮状态*/
    function switchForNoTable() {
        let elems = Array.prototype.slice.call($('.js-switch-notable'));
        elems.forEach(function (html) {
            /* size: 'normal' 控制大小*/
            switchery_notable = new Switchery(html);
            html.onchange = function () {
                checked_notable = html.checked;
            }
        });
    }

    $('#tab-1 button[title="考试管理"]').click(function () {
        $('#topicManagement').fadeIn(1500);
        $('#createTestPaper').fadeOut(500);
        $('#tab-1 button[title="考试管理"]').attr('class', 'btn btn-success dropdown-toggle')
        $('#tab-1 button[title="创建考试"]').attr('class', 'btn btn-white dropdown-toggle')
    });

    let useOrRemovePaper = "";
    $('#createTestPaper_1 input[name="setTestPaper"]').focus(function () {
        $("#modal_5").modal()
    });
</script>
<!--表单、动态搜索初始化-->
<script>
    let url = '../../static/js/demo/exam/testQuestionsListTest2.json';
    //名称
    bsSuggest(".testPaperName", url, "testPaperName");
    //状态
    bsSuggest(".state", url, "state");
    //分类
    bsSuggest(".classification", url, "classification");
    //考试排序
    bsSuggest(".trySorting", url, "trySorting");
    //考试展示
    bsSuggest(".tryShow", url, "paperShow");
    //选项随机
    bsSuggest(".optionRandom", url, "trySorting");
    //公布答案
    bsSuggest(".announcedAnswer", url, "announcedAnswer");
    //查看详情
    bsSuggest(".checkDetails", url, "checkDetails");
    //时间配置
    timeAllocationForTime('.datapicker');

    /**************************************************表单********************************************/
    //我的考试--考试管理
    //查询
    $('#examManagementForm .query').click(function () {
        let dataList = new Array('testPaperName', 'state', 'classification', 'startTime', 'endTime');
        queryRecords('#examManagementForm', dataList);
    });

    //创建考试、修改考试
    /*按钮切换*/
    function testPaper(addOrUpdate) {
        $('#createTestPaper').fadeIn(1500);
        $('#topicManagement').fadeOut(500);
        $('#tab-1 button[title="创建考试"]').attr('class', 'btn btn-success dropdown-toggle')
        $('#tab-1 button[title="考试管理"]').attr('class', 'btn btn-white dropdown-toggle')
        //回显数据
        if (judging) {
            echoData(parameters);
        } else {
            $("#createTestPaper form")[0].reset();
            $("#createTestPaper form")[1].reset();
            testClassGroup_deleteAll();
            testStudentGroup_deleteAll();
            $('#createTestPaper form .form-control').css('border-color', "")
            switchery_notable.setPosition(false);
        }
        //如果是更新，则去掉按钮颜色
        if (addOrUpdate == "update") {
            //禁用设置考试
            $('#createTestPaper_1 input[name="setTestPaper"]').attr("disabled",'disabled');
            $('#tab-1 button[title="创建考试"]').attr('class', 'btn btn-white dropdown-toggle');
        } else {
            $('#createTestPaper_1 input[name="setTestPaper"]').removeAttr("disabled");
        }
        //重置属性状态
        judging = false;
        parameters.splice(0, parameters.length);
    }

    function switchover(addOrUpdate) {
        judging = false;
        testPaper(addOrUpdate);
    }

    //数据回显
    function echoData(arrayForEvent) {
        //准备数据
        let arrayForValue = new Map();
        let arrayIsNull = new Array();
        if (arrayForEvent.length < 1) {
            return false;
        }
        arrayForEvent.forEach(function (item, index) {
            item.val() != "" ? arrayForValue.set(item, item.val()) : arrayIsNull.push(item);
        })
        //刷新页面
        $("#createTestPaper form")[0].reset();
        $("#createTestPaper form")[1].reset();
        //回显数据
        if (arrayForValue.size > 0) {
            arrayForValue.forEach(function (value, key) {
                key.css('border-color') == "#f8ac59" ? key.css('border-color', '') : "";
                key.val(value);
            });
        }
        if (arrayIsNull.length > 0) {
            arrayIsNull.forEach(function (item, index) {
                item.css('border-color', "#f8ac59");
            })
        }
        //清空集合
        arrayForValue.clear();
        arrayIsNull.splice(0, arrayIsNull.length);
        console.log("回显成功");
    }

    let parameters = new Array()
    let judging = false;

    function testProcessing(addOrUpdate) {
        let testPaperName = $('#createTestPaper_1 input[name="testPaperName"]');
        let classification = $('#createTestPaper_1 input[name="classification"]');
        let startUsing = checked_notable;
        let setTestPaper = $('#createTestPaper_1 input[name="setTestPaper"]');
        let passMark = $('#createTestPaper_1 input[name="passMark"]');

        let trySorting = $('#createTestPaper_1 input[name="trySorting"]');
        let tryShow = $('#createTestPaper_1 input[name="tryShow"]');
        let optionRandom = $('#createTestPaper_1 input[name="optionRandom"]');
        let canTestTimes = $('#createTestPaper_1 input[name="canTestTimes"]');
        let testInstructions = $('#createTestPaper_1 textarea[name="testInstructions"]');

        let startTime = $('#createTestPaper_2 input[name="startTime"]');
        let endTime = $('#createTestPaper_2 input[name="endTime"]');
        let testTime = $('#createTestPaper_2 input[name="testTime"]');
        let releaseTime = $('#createTestPaper_2 input[name="releaseTime"]');
        let submitLimit = $('#createTestPaper_2 input[name="submitLimit"]');

        let toLimit = $('#createTestPaper_2 input[name="toLimit"]');
        let announcedAnswer = $('#createTestPaper_2 input[name="announcedAnswer"]');
        let checkDetails = $('#createTestPaper_2 input[name="checkDetails"]');
        if (arrayClazz.length < 1 && arrayStudent.length < 1) {
            judging = true;
        }
        parameters.push(testPaperName, classification, setTestPaper, passMark, tryShow, trySorting, optionRandom, canTestTimes, testInstructions,
            startTime, endTime, testTime, releaseTime, submitLimit, toLimit, announcedAnswer, checkDetails);
        let query_data = "{";
        parameters.forEach(function (item, index) {
            if (item.val() == "") {
                judging = true;
            }
            let record = (parameters.length - index) != 1 ? '"' + item.attr('name') + '":' + item.val() + ',' : '"' + item.attr('name') + '":' + item.val();
            query_data = query_data + record;

        });
        query_data = query_data + '"+startUsing":' + startUsing + '"+arrayClazz+":' + arrayClazz + '"+arrayStudent+"' + arrayStudent;
        console.log(arrayClazz, arrayStudent)
        query_data = query_data + "}";
        console.log(query_data)
        if (addOrUpdate == "add") {
            //发送添加操作
        } else {
            //发送更新操作
        }
        /* //发送ajax 查询
            $.ajax({
                url: appName+"/book/deleteSelect.do",
                method: "post",
                async: true,
                data: query_data,
                dataType: "text",   //期望服务端返回的数据类型
                contentType: "application/json",
                success: function (data) {
                    console.log(data.toString());
                    //重新加载页面
                    $('#tb_departments').bootstrapTable('load', data);
                },
                error: function (jqXHR) {
                    swal("搜索失败！", "未知错误", "error");
                }
            });*/
        if (judging) {
            swal("操作失败！", "数据不允许为空", "error");
        } else {
            addOrUpdate == "add" ? swal("提交成功！", "已为你重新加载页面", "success") : swal("更新成功！", "已为你重新加载页面", "success");
        }
        pageJudgment(addOrUpdate);
    }

    //跳转页面判断
    function pageJudgment(addOrUpdate) {
        addOrUpdate == "add" ? testPaper("add") : testPaper("update");
    }

    //提交按钮
    $('#createTestPaper .add').click(function () {
        if ($('#tab-1 button[title="创建考试"]').attr('class') != 'btn btn-white dropdown-toggle') {
            testProcessing("add");
        } else {
            testProcessing("update");
        }

    });
    //重置按钮
    $('#createTestPaper .reset').click(function () {
        $("#createTestPaper form")[0].reset();
        $("#createTestPaper form")[1].reset();
        testClassGroup_deleteAll();
        testStudentGroup_deleteAll();
        $('#createTestPaper form .form-control').css('border-color', "")
        switchery_notable.setPosition(false);
    });

    //创建考试考试对象中的添加班级按钮
    $('#testClassGroup_add').click(function () {
        $('#modal_3').modal();
    })
    //渲染表格
    $('#tb_departments_3').bootstrapTable({
        url: '../../static/js/demo/exam/testClassGroupData.json',
        method: 'get',
        striped: true,
        cache: true,
        pagination: true,
        pageNumber: 1,
        pageSize: 5,
        clickToSelect: true,
        pageList: [10, 25, 50, 100],
        uniqueId: "id",
        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        showSearchButton: true,
        searchAlign: "left",
        onPostBody: switchForTable_2,
        columns: [
            {
                checkbox: true,
                formatter: function (value, row, index) {
                    // if(row.check){
                    //     return {
                    //         checked: true
                    //     }
                    // }
                    if (row.state == "禁用") {
                        return {
                            disabled: true
                        }
                    }
                    if ($.inArray(row.id, overAllIds) != -1) {// 因为 判断数组里有没有这个 id
                        return {
                            checked: true               // 存在则选中
                        }
                    }
                }
            }, {
                title: "班级",
                field: "clazz"
            }, {
                title: "学生人数",
                field: "studentsNumber"
            }, {
                title: "状态",
                formatter: state_clazz
            }
        ]
    });
    //创建考试考试对象中的添加班级按钮
    $('#testStudentGroup_add').click(function () {
        $('#modal_4').modal();
    })
    //渲染表格
    $('#tb_departments_4').bootstrapTable({
        url: '../../static/js/demo/exam/testStudentGroupData.json',
        method: 'get',
        striped: true,
        cache: true,
        pagination: true,
        pageNumber: 1,
        pageSize: 5,
        clickToSelect: true,
        pageList: [10, 25, 50, 100],
        uniqueId: "id",
        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        showSearchButton: true,
        searchAlign: "left",
        onPostBody: switchForTable_3,
        columns: [
            {
                checkbox: true,
                formatter: function (value, row, index) {
                    // if(row.check){
                    //     return {
                    //         checked: true
                    //     }
                    // }
                    if (row.state == "禁用") {
                        return {
                            disabled: true
                        }
                    }
                    if ($.inArray(row.id, overAllIds) != -1) {// 因为 判断数组里有没有这个 id
                        return {
                            checked: true               // 存在则选中
                        }
                    }
                }
            }, {
                title: "用户名",
                field: "name"
            }, {
                title: "编号",
                field: "stuId"
            }, {
                title: "班级",
                field: "clazz"
            }, {
                title: "注册时间",
                field: "registrationTime"
            }, {
                title: "状态",
                formatter: state_Student
            }
        ]
    });
    let arrayClazz = new Array();
    let arrayStudent = new Array()
    //创建考试考试对象中的添加班级的按钮
    $('#modal_3 button').click(function () {
        let row = $('#tb_departments_3').bootstrapTable('getAllSelections');
        arrayClazz = bulkInsert(row, arrayClazz, 'clazz', '#testClassGroup')
        console.log(arrayClazz.length)
    });
    //创建考试考试对象中的清空班级的按钮
    $('#testClassGroup_deleteAll').click(function () {
        testClassGroup_deleteAll();
        console.log(arrayClazz.length)
    });

    function testClassGroup_deleteAll() {
        $('#tb_departments_3').bootstrapTable('uncheckAll');
        let row = $('#tb_departments_3').bootstrapTable('getAllSelections')
        row = new Array();
        arrayClazz = bulkInsert(row, arrayClazz, 'clazz', '#testClassGroup')
    }

    function deleteOneToTestClassGroup(event) {
        let id = $(event).attr('sign') - 1 + 1;
        $('#tb_departments_3').bootstrapTable('uncheckBy', {field: 'id', values: [id]});
        let row = $('#tb_departments_3').bootstrapTable('getAllSelections');
        arrayClazz = bulkInsert(row, arrayClazz, 'clazz', '#testClassGroup')
        console.log(arrayClazz.length)
    }

    //创建考试考试对象中的添加学生的按钮
    $('#modal_4 button').click(function () {
        let row = $('#tb_departments_4').bootstrapTable('getAllSelections');
        arrayStudent = bulkInsert_1(row, arrayStudent, 'name', '#testStudentGroup')
        console.log(arrayStudent.length)
    });
    //创建考试考试对象中的清空学生的按钮
    $('#testStudentGroup_deleteAll').click(function () {
        testStudentGroup_deleteAll();
        console.log(arrayStudent.length)
    });

    function testStudentGroup_deleteAll() {
        $('#tb_departments_4').bootstrapTable('uncheckAll');
        let row = $('#tb_departments_4').bootstrapTable('getAllSelections')
        row = new Array();
        arrayStudent = bulkInsert_1(row, arrayStudent, 'name', '#testStudentGroup')
    }

    function deleteOneToTestStudentGroup(event) {
        let id = $(event).attr('sign') - 1 + 1;
        $('#tb_departments_4').bootstrapTable('uncheckBy', {field: 'id', values: [id]});
        let row = $('#tb_departments_4').bootstrapTable('getAllSelections');
        arrayStudent = bulkInsert_1(row, arrayStudent, 'name', '#testStudentGroup')
        console.log(arrayStudent.length)
    }

    //加载标签的按钮(班级)
    function bulkInsert(row, array, name, event_add) {
        array = row;
        row.forEach(function (item, index) {
            array.push(item);
        });
        array = Array.from(new Set(array));
        $(event_add).empty();
        array.forEach(function (item, index) {
            $(event_add).append(
                '<button type="button" class="btn btn-info" sign="' + item.id + '" style="margin: 5px" title="点我删除" onclick="deleteOneToTestClassGroup(this)"> ' +
                '<span>' + item[name] + '</span>&nbsp;&nbsp;<i class="fa fa-close"style="color: #8a1f11"></i> ' +
                '</button>'
            )
        })
        return array;
    }

    //加载标签的按钮（学生）
    function bulkInsert_1(row, array, name, event_add) {
        array = row;
        row.forEach(function (item, index) {
            array.push(item);
        });
        array = Array.from(new Set(array));
        $(event_add).empty();
        array.forEach(function (item, index) {
            $(event_add).append(
                '<button type="button" class="btn btn-info" sign="' + item.id + '" style="margin: 5px" title="点我删除" onclick="deleteOneToTestStudentGroup(this)"> ' +
                '<span>' + item[name] + '</span>&nbsp;&nbsp;<i class="fa fa-close"style="color: #8a1f11"></i> ' +
                '</button>'
            )
        })
        return array;
    }

    /**********************创建考试中的选择班级或学生的初始化************************/
    //状态
    function state_clazz(value, row, index) {
        return row.state == '启用' ? ' <input type="checkbox" class="js-switch-table-state_2 form-control" checked/>' :
            ' <input type="checkbox" class="js-switch-table-state_2 form-control"/>'
    }

    function state_Student(value, row, index) {
        return row.state == '启用' ? ' <input type="checkbox" class="js-switch-table-state_3 form-control" checked/>' :
            ' <input type="checkbox" class="js-switch-table-state_3 form-control"/>'
    }

    //初始化滑动按钮状态
    function switchForTable_2() {
        let elems = Array.prototype.slice.call($('.js-switch-table-state_2'));
        elems.forEach(function (html) {
            /* size: 'normal' 控制大小*/
            let switchery = new Switchery(html);
            switchery.disable();
        });
    }

    function switchForTable_3() {
        let elems = Array.prototype.slice.call($('.js-switch-table-state_3'));
        elems.forEach(function (html) {
            /* size: 'normal' 控制大小*/
            let switchery = new Switchery(html);
            switchery.disable();
        });
    }

    $('#tb_departments_3').on('uncheck.bs.table check.bs.table check-all.bs.table uncheck-all.bs.table', function (e, rows) {
        let datas = $.isArray(rows) ? rows : [rows];        // 点击时获取选中的行或取消选中的行
        examine(e.type, datas);                              // 保存到全局 Array() 里
    });
    $('#tb_departments_4').on('uncheck.bs.table check.bs.table check-all.bs.table uncheck-all.bs.table', function (e, rows) {
        let datas = $.isArray(rows) ? rows : [rows];        // 点击时获取选中的行或取消选中的行
        examine(e.type, datas);                              // 保存到全局 Array() 里
    });

    let overAllIds = new Array();  //全局数组
    function examine(type, datas) {
        if (type.indexOf('uncheck') == -1) {
            $.each(datas, function (i, v) {
                // 添加时，判断一行或多行的 id 是否已经在数组里 不存则添加　
                overAllIds.indexOf(v.id) == -1 ? overAllIds.push(v.id) : -1;
            });
        } else {
            $.each(datas, function (i, v) {
                overAllIds.splice(overAllIds.indexOf(v.id), 1);    //删除取消选中行
            });
        }
    }


    /********************************************END---表单********************************************/
</script>
<!--表格-->
<script>
    /*考试管理表格*/
    let testQuestionsListTestJson = '../../static/js/demo/exam/testQuestionsListTest.json';
    // createTable('.tb_departments',testQuestionsListTestJson,'#toolbar',false,data_testQuestionsListTest,'get')
    $('.tb_departments').bootstrapTable({
        url: '../../static/js/demo/exam/testQuestionsListTest.json',
        // method: 'get',
        toolbar: '#toolbar',
        striped: true,
        cache: false,
        pagination: true,
        pageNumber: 1,
        pageSize: 5,
        pageList: [10, 25, 50, 100],
        uniqueId: "id",
        onPostBody: switchForTable,
        columns:
            [{
                checkbox: true
            }, {
                title: '考试|考试',
                formatter: testPaperName,
                events: {
                    /*预览考试*/
                    'click a[title="预览考试"]': detailedTestPaper /*END--预览考试*/
                }
            }, {
                field: 'classification',
                title: '分类'
            }, {
                title: '状态',
                formatter: state
            }, {
                title: "考试时间",
                formatter: testTime
            }, {
                title: '考试总分',
                formatter: totalScore
            }, {
                title: '考试人次',
                formatter: citations,
                events: {
                    'click a[title=点我查看详情]': testRecordsHeader
                }
            }, {
                title: '最后修改',
                formatter: lastModified
            }, {
                title: '操作',
                formatter: operation,
                events: {
                    /*删除*/
                    'click button[title=删除]': function (e, value, row, index) {
                        deleteRecord(e, value, row, index, "", '.tb_departments');
                    },  /*END--删除*/
                    /*修改*/
                    'click button[title=修改]': function (e, value, row, index) {
                        testPaper("update");
                        //获取部分json信息
                        let ajaxData = getAjaxSynchronousData("../../static/js/demo/exam/examManagementList.json", "get");
                        //基本信息
                        let echoDataList = new Array();
                        echoDataList.push("testPaperName", "classification", [switchery_notable, "state", "sweetalert"], "trySorting", ["setTestPaper", "testPaperName"]
                            , ["optionRandom", "trySorting"], ["tryShow", "paperShow"], ["passMark", ajaxData[0].passMark],
                            ["canTestTimes", ajaxData[0].canTestTimes]);
                        $('#createTestPaper_1 textarea[name=testInstructions]').val(ajaxData[0].testInstructions);
                        echoDataForm('#createTestPaper_1', echoDataList, row);
                        let echoDataList_1 = new Array("startTime", "endTime", ["releaseTime", ajaxData[0].releaseTime]
                                ["submitLimit", ajaxData[0].submitLimit], ["toLimit", ajaxData[0].toLimit], ["testTime", ajaxData[0].testTime]
                            , ["announcedAnswer", ajaxData[0].announcedAnswer], ["checkDetails", ajaxData[0].checkDetails]);
                        echoDataList_1.push()
                        echoDataForm('#createTestPaper_2', echoDataList_1, row);
                        //回显选中的标签
                        //班级
                        getAjaxAsynchronousData('../../static/js/demo/exam/testClassGroupData.json', 'get', function (result) {
                            let row_clazz = new Array();
                            result.forEach(function (item, index) {
                                if (item.check) {
                                    row_clazz.push(item);
                                    $('#tb_departments_3').bootstrapTable('checkBy', {field: 'id', values: [item.id]});
                                }
                            })
                            arrayClazz = bulkInsert(row_clazz, arrayClazz, 'clazz', '#testClassGroup')
                            console.log(row_clazz, arrayClazz)
                        })
                        //学生
                        getAjaxAsynchronousData('../../static/js/demo/exam/testStudentGroupData.json', 'get', function (result) {
                            let row_student = new Array();
                            result.forEach(function (item, index) {
                                if (item.check) {
                                    row_student.push(item);
                                    $('#tb_departments_4').bootstrapTable('checkBy', {field: 'id', values: [item.id]});
                                }
                            })
                            arrayStudent = bulkInsert_1(row_student, arrayStudent, 'name', '#testStudentGroup')
                            console.log(row_student, arrayStudent)
                        })


                        judging = false;
                    },  /*END--修改*/
                    /*考试记录*/
                    'click button[title=考试记录]': testRecordsHeader
                    /*END--考试记录*/
                }
            }]
    });

    /*考试记录表头信息回显*/
    function testRecordsHeader(e, value, row, index) {
        $('#isTestRecords .cephalosome .testPaperName_1').text(row.testPaperName);
        $('#isTestRecords .cephalosome .startTime').text(row.startTime);
        $('#isTestRecords .cephalosome .endTime').text(row.endTime);
        $('#isTestRecords .cephalosome .testTime').text(row.testTime)
        $('#isTestRecords .cephalosome .totalPoints').text(row.totalPoints)
        $('#isTestRecords .cephalosome .passMark').text(row.passMark)
        $('#isTestRecords').fadeIn(1000);
        $('#noIsTestRecords').fadeOut(500);
    }

    /***********************************************参数个性化********************************************/
    //考试|考试
    function testPaperName(value, row, index) {
        return '<p>' + row.testSubjects + '</p>' +
            '<a class="text-muted" title="预览考试"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;&nbsp;' + row.testPaperName + '</a>';
    }

    //状态
    function state(value, row, index) {
        return row.state == '启用' ? ' <input type="checkbox" class="js-switch-table-state form-control" checked/>' :
            ' <input type="checkbox" class="js-switch-table-state form-control"/>'
    }

    //考试时间
    function testTime(value, row, index) {
        return '<strong><p>' + row.startTime + '</p></strong><p class="text-muted">' + row.endTime + '</p>';
    }

    //总分
    function totalScore(value, row, index) {
        return row.totalScore >= 80 ? '<strong><a href="#" class="text-success" style="font-size:20px;">' + row.totalScore + '</a></strong>' :
            row.totalScore >= 60 ? '<strong><a href="#" class="text-warning" style="font-size:20px;">' + row.totalScore + '</a></strong>' :
                '<strong><a href="#" class="text-danger" style="font-size:20px;">' + row.totalScore + '</a></strong>';
    }

    //考试人次
    function citations(value, row, index) {
        return '<strong><a class="text-success" style="font-size:20px;" title="点我查看详情">' + row.citations + '</a></strong>次';
    }


    //最后修改
    function lastModified(value, row, index) {
        return '<strong><p>' + row.modifier + '</p></strong><p>' + row.lastModifiedTime + '</P>';
    }

    //操作
    function operation(value, row, index) {
        return '<button id = "+id+" type = "button" class = "btn btn-white" title="考试记录"> <i class="glyphicon glyphicon-eye-open"/> </button>' +
            '<button id = "+id+" type = "button" class = "btn btn-white" title="修改"> <i class="glyphicon glyphicon-edit text-success"/> </button>' +
            '<button id = "+id+" type = "button" class = "btn btn-white" title="删除"> <i class="glyphicon glyphicon-trash text-danger"/> </button>';
    }

    //初始化滑动按钮状态
    function switchForTable() {
        let elems = Array.prototype.slice.call($('.js-switch-table-state'));
        elems.forEach(function (html) {
            /* size: 'normal' 控制大小*/
            let switchery = new Switchery(html);
            html.onchange = function () {
                alert(html.checked);
            }
        });
    }

    /*******************************************END---参数个性化********************************************/
    /*END--考试管理表格*/
</script>
<!--************************************END-非考试记录部分***************************************-->
<!--***************************************考试记录部分******************************************-->
<!--表单-->
<script>
    let url_1 = '../../static/js/demo/exam/examManagementList2.json';
    //考生组
    bsSuggestNoShow(".examineeGroup", url_1, "examineeGroup");
    //职务
    bsSuggestNoShow(".duty", url_1, "duty");
    //排序方式
    bsSuggestNoShow(".sortord", url_1, "sortord");
    //显示全部答案
    bsSuggestNoShow(".show", url_1, "show");

    //考试记录
    $('#testRecords_form .query').click(function () {
        let dataList = new Array('keyword', 'examineeGroup', 'duty', 'sortord', 'show');
        queryRecords('#testRecords_form', dataList);
    });

    //缺考查询
    $('#lackTestRecords_form .query').click(function () {
        let dataList = new Array('keyword', 'examineeGroup', 'duty');
        queryRecords('#lackTestRecords_form', dataList);
    });

    //返回按钮
    $('.getBack').click(function () {
        $('#noIsTestRecords').fadeIn(1000);
        $('#isTestRecords').fadeOut(500);
    });

    //刷新按钮
    $('.refresh').click(function () {
        $('#isTestRecords').fadeOut(500);
        $('#isTestRecords').fadeIn(1500);
    });
</script>
<!--表格-->
<script>
    $('#tb_departments_1').bootstrapTable({
        url: '../../static/js/demo/exam/examManagementList.json',
        // method: 'get',
        striped: true,
        cache: false,
        pagination: true,
        pageNumber: 1,
        pageSize: 5,
        pageList: [10, 25, 50, 100],
        uniqueId: "id",
        onPostBody: switchForTable_1,
        columns:
            [{
                checkbox: true
            }, {
                title: "考生",
                formatter: examinee
            }, {
                title: "考生组",
                field: "examineeGroup"
            }, {
                title: "证件号",
                field: "idNumber"
            }, {
                title: "考试时间",
                formatter: testTime
            }, {
                title: "考试用时",
                formatter: examTime
            }, {
                title: "批改状态",
                formatter: correctingState
            }, {
                title: "得分",
                formatter: score
            }, {
                title: "来源",
                formatter: source
            }, {
                title: "操作",
                formatter: operation_1,
                events: {
                    /*删除*/
                    'click button[title=删除]': function (e, value, row, index) {
                        deleteRecord(e, value, row, index, "", '#tb_departments_1');
                    },  /*END--删除*/
                    /*批阅试卷*/
                    'click button[title=批阅试卷]': function (e, value, row, index) {
                        getIframeAjaxData(row);
                    }
                    /*END--批阅试卷*/
                }
            }]
    });

    let lackTestRecordsData = [
        {
            title: "用户名",
            field: "examinee"
        }, {
            title: "真实姓名",
            field: "name"
        }, {
            title: "证件编号",
            field: "idNumber"
        }, {
            title: "考生组",
            field: "examineeGroup"
        }, {
            title: "职务",
            field: "position"
        }, {
            title: "状态",
            formatter: lackTestState
        }, {
            title: "注册时间",
            field: "registrationTime"
        }, {
            title: "最后登陆时间",
            field: "releaseTime"
        }
    ];
    createTable('#tb_departments_2', "../../static/js/demo/exam/examManagementList.json", "", false, lackTestRecordsData, "get");

    //创建考试---设置试卷---我的试卷
    let myPaperData = [{
            title: '试卷名称',
            formatter: testPaperName
        }, {
            title: '考试时间',
            formatter: citations
        }, {
            title: '总分',
            formatter: totalScore
        }, {
            title: '创建人',
            field: "modifier"
        }, {
            title: "操作",
            formatter: useOrRemove,
            events: {
                'click .useOrRemove': function (e, value, row, index) {
                    useOrRemovePaper = row.testPaperName;
                    $('.useOrRemove').text("使用").attr('class', 'btn btn-white useOrRemove');
                    $(this).text("移除").attr('class', 'btn btn-danger useOrRemove');
                    $('#createTestPaper_1 input[name="setTestPaper"]').val(useOrRemovePaper);
                }
            }
        }]
    ;
    createTable('#tb_departments_5', '../../static/js/demo/exam/testQuestionsListTest.json', "", true, myPaperData, "get");
    //创建考试---设置试卷---我的试卷
    let sharedPaper = [{
            title: '试卷名称',
            formatter: testPaperName
        }, {
            title: '考试时间',
            formatter: citations
        }, {
            title: '总分',
            formatter: totalScore
        }, {
            title: '创建人',
            field: "modifier"
        }, {
            title: "操作",
            formatter: useOrRemove,
            events: {
                'click .useOrRemove': function (e, value, row, index) {
                    useOrRemovePaper = row.testPaperName;
                    $('.useOrRemove').text("使用").attr('class', 'btn btn-white useOrRemove');
                    $(this).text("移除").attr('class', 'btn btn-danger useOrRemove');
                    $('#createTestPaper_1 input[name="setTestPaper"]').val(useOrRemovePaper);
                }
            }
        }]
    ;
    createTable('#tb_departments_6', '../../static/js/demo/exam/testQuestionsListTest.json', "", true, sharedPaper, "get");

    /***********************************************参数个性化********************************************/
    //考生
    function examinee(value, row, index) {
        return '<strong><p>' + row.examinee + '</p></strong><p>' + row.name + '</P>';
    }

    //考试用时
    function examTime(value, row, index) {
        return '<strong><a class="text-success" style="font-size:20px;">' + row.examTime + '</a></strong>分钟';
    }

    //批改状态
    function correctingState(value, row, index) {
        return row.correctingState == 'true' ? ' <input type="checkbox" class="js-switch-table-state_1 form-control" checked/>' :
            ' <input type="checkbox" class="js-switch-table-state_1 form-control"/>'
    }

    //得分
    function score(value, row, index) {
        return row.score >= 80 ? '<strong><a href="#" class="text-success" style="font-size:20px;">' + row.score + '</a></strong>' :
            row.score >= 60 ? '<strong><a href="#" class="text-warning" style="font-size:20px;">' + row.score + '</a></strong>' :
                '<strong><a href="#" class="text-danger" style="font-size:20px;">' + row.score + '</a></strong>';
    }

    //来源
    function source(value, row, index) {
        return '<a class="text-muted"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;&nbsp;' + row.source + '</a>';
    }

    //缺考状态
    function lackTestState(value, row, index) {
        return row.state == "正常" ? '<strong><a href="#" class="text-success" style="font-size:15px;">' + row.state + '</a></strong>' :
            '<strong><a href="#" class="text-warning" style="font-size:15px;">' + row.state + '</a></strong>';

    }

    //操作
    function operation_1(value, row, index) {
        return '<button id = "+id+" type = "button" class = "btn btn-white" title="批阅试卷"> <i class="glyphicon glyphicon-edit text-success"/> </button>' +
            '<button id = "+id+" type = "button" class = "btn btn-white" title="删除"> <i class="glyphicon glyphicon-trash text-danger"/> </button>';
    }

    function useOrRemove(value, row, index) {
        return '<button data-dismiss="modal" useOrRemove = "' + row.testPaperName + '" type = "button" class = "btn btn-white useOrRemove" title="使用">使用</button>'
    }

    //初始化滑动按钮状态
    function switchForTable_1() {
        let elems = Array.prototype.slice.call($('.js-switch-table-state_1'));
        elems.forEach(function (html) {
            /* size: 'normal' 控制大小*/
            let switchery = new Switchery(html);
            html.onchange = function () {
                alert(html.checked);
            }
        });
    }

    /******************************************END---参数个性化********************************************/
</script>
<!--按钮组事件监听-->
<script>
    $('button[title=将考生成绩导出为EXCEL]').click(function () {
        exportRecord("", "考生成绩");
    });
    $('button[title=导出所有考生答卷]').click(function () {
        exportRecord("", "所有考生答卷", "压缩包");
    });
    $('button[title=查看缺考名单]').click(function () {
        $('#modal_2').modal();
    });
    $('button[title=重新批改所有考生答卷]').click(function () {
        promptMessage("", "确定要重新批改所有考生答卷吗？", "重新批改可能影响考生的成绩，请谨慎操作。", "确定");
    });
    $('button[title=快速批改主观题]').click(function () {
        let data = getAjaxSynchronousData('../../static/js/demo/exam/markExamPapersIFrame2.json', 'get');
        getSubjectiveItem(data, 0);
    });
    $('button[title=清空考生答卷]').click(function () {
        deleteAllRecords("", '#tb_departments_1');
    });
    $('button[title=导出缺考名单]').click(function () {
        exportRecord("", "所有缺考人员");
    });


</script>
<!--批改试卷iframe初始化-->
<script>
    function getIframeAjaxData(row) {
        parent.layer.open({
            type: 2,
            content: 'exam/markExamPapersIFrame.html',
            area: ['85%', '85%'],
            shadeClose: true,
            maxmin: true,
            title: "《" + row.name + '答卷详情' + "》" + "---第" + row.currentNumber + '/' + row.canTestTimes + "次考试",
            success: function (layero, index) {
                let body = parent.layer.getChildFrame('body', index);
                let iframeWin = window[layero.find('iframe')[0]['name']];
                body.find('.buttons').fadeIn(1000);
                body.find('.tabs-container').slideUp(1000);
                //隐藏分页
                body.find('#navigationGroup').css('display', 'none');
                //表头个人信息
                getAjaxAsynchronousData('../../static/js/demo/exam/testQuestionsListTest.json', 'get', function (result) {
                    body.find('table a[name=testSubjects]').text(result[0]['testSubjects']);
                });
                let name = new Array('name', 'examinee', 'canTestTimes', 'currentNumber', 'examTime', 'totalPoints', 'score',
                    'passMark', 'testTime', 'startTime', 'endTime');
                name.forEach(function (item, index) {
                    body.find('table a[name=' + item + ']').text(row[item]);
                });
                //试题部分
                getAjaxAsynchronousData('../../static/js/demo/exam/markExamPapersIFrame.json', 'get', function (result) {

                    let mapData = new Map();
                    body.find('table').attr('students_tag', result['id'])
                    mapData.set(result['value'][0]['question_types'], new Array(result['value'][0]));
                    //将得到的数据进行分类
                    for (let i in result['value']) {
                        getData(mapData, result['value'][i]['question_types'], 'question_types') &&
                        !getData(mapData, result['value'][i]['id'], 'id') ?
                            mapData.forEach(function (value, key) {
                                key == result['value'][i]['question_types'] ?
                                    value.push(result['value'][i]) : ""
                            }) :
                            mapData.set(result['value'][i]['question_types'], new Array(result['value'][i]));
                    }
                    //生成内容
                    let question_types_number = 0;
                    let tab_id = 1;
                    mapData.forEach(function (value, key) {
                        //动态生成题目类型
                        body.find('.particulars:last').after(body.find('.types:eq(0)').clone())
                        body.find('.types:last').find('p[name=question_types]').html("&nbsp;&nbsp;&nbsp;" + key);
                        body.find('.tabs-container li:last').after(
                            body.find('.tabs-container li:first').clone()
                        );
                        body.find('.tabs-container .tab-content .tab-pane:last').after(
                            body.find('.tabs-container .tab-content .tab-pane:first').clone()
                        );
                        body.find('.tabs-container li:last a').attr('href', '#tab-' + tab_id).text(key);
                        body.find('.tabs-container .tab-content .tab-pane:last').attr('id', 'tab-' + tab_id);
                        for (let i in value) {
                            question_types_number++;
                            //动态生成题目
                            //克隆题目内容的样式
                            body.find('.types:last').after(body.find('.particulars:eq(0)').clone().attr('sign', value[i]["id"]));
                            if (key == "单选题") {
                                body.find('div[sign=' + value[i]["id"] + '] .topic hr').after(
                                    body.find('div[name=option]:last').clone()
                                );
                                Object.values(value[i]["option"]).forEach(function (item, index) {
                                    body.find('div[sign=' + value[i]["id"] + ']  .topic div[name=option] .col-md-11').append(
                                        "<p>" + String.fromCharCode(65 + index) + "." + item + "</p>"
                                    );
                                })
                            }
                            if (key == "编程题") {
                                Object.keys(value[i]).forEach(function (key) {
                                    //往样式里传值html("<pre class=\"layui-code\">"+value[i]['stu_answer']+"</pre>"
                                    if (key == 'stu_answer') {
                                        body.find('div[sign=' + value[i]["id"] + '] a[name=stu_answer]').append(
                                            body.find('.layui-code:last').clone()
                                        );
                                        body.find('div[sign=' + value[i]["id"] + '] a[name=stu_answer]  .layui-code span').text(
                                            value[i]['stu_answer']
                                        )
                                    } else if (key == 'sta_answer') {
                                        body.find('div[sign=' + value[i]["id"] + '] a[name=sta_answer]').append(
                                            body.find('.layui-code:last').clone()
                                        );
                                        body.find('div[sign=' + value[i]["id"] + '] a[name=sta_answer]  .layui-code span').text(
                                            value[i]['sta_answer']
                                        );
                                    } else {
                                        body.find('div[sign=' + value[i]["id"] + '] a[name=' + key + ']').text(value[i][key]);
                                    }
                                })
                            } else {
                                Object.keys(value[i]).forEach(function (key) {
                                    //往样式里传值
                                    body.find('div[sign=' + value[i]["id"] + '] a[name=' + key + ']').text(value[i][key]);
                                })
                            }
                            //动态生成按钮
                            body.find('#tab-' + tab_id + ' .col-md-1:last').after(
                                body.find('#tab-' + tab_id + ' .col-md-1:first').clone()
                            )
                            value[i]['points_scored'] == "0" ?
                                body.find('#tab-' + tab_id + ' .col-md-1:last button').attr({
                                    'butMark': question_types_number,
                                    'class': 'btn btn-danger'
                                }).text(question_types_number) :
                                body.find('#tab-' + tab_id + ' .col-md-1:last button').attr({
                                    'butMark': question_types_number,
                                    'class': 'btn btn-success'
                                }).text(question_types_number);
                            //给定id
                            body.find('div[sign=' + value[i]["id"] + '] .points_scored').attr('id', value[i]["id"]);
                            //改变样式
                            value[i]['points_scored'] == "0" ? body.find('div[sign=' + value[i]["id"] + '] a[name=points_scored]').attr('class', 'text-danger') : "";
                            value[i]['stu_answer'] == "未作答" ? body.find('div[sign=' + value[i]["id"] + '] a[name=stu_answer]').attr('class', 'text-danger') : "";
                        }
                        //隐藏第一个参考按钮
                        body.find('#tab-' + tab_id + ' .col-md-1:first').css('display', 'none');
                        tab_id++;
                    });
                    //隐藏参考数据
                    body.find('.types:first').css('display', 'none');
                    body.find('.particulars:first').css('display', 'none');
                    body.find('div[name="option"]:last').css('display', 'none');
                    body.find('pre:last').css('display', 'none');
                    body.find('.tabs-container .tab-content .tab-pane:first').css('display', 'none');
                    body.find('.tabs-container li:first').css('display', 'none');
                    body.find('.tabs-container li:eq(1)').attr('class', 'active');
                    body.find('.tabs-container .tab-pane:eq(1)').attr('class', 'tab-pane active');
                    //给定序号
                    console.log(question_types_number)
                    for (let i = 0; i <= question_types_number; i++) {
                        body.find('button[name=number]:eq(' + i + ')').text(i);
                        body.find('button[name=number]:eq(' + i + ')').attr('number', i);
                    }

                    function getData(gather, character, keyword) {
                        let judge = false;
                        mapData.forEach(function (value, key) {
                            for (let i in value) {
                                if (judge) {
                                    break;
                                }
                                judge = (character == value[0][keyword]);
                            }
                        })
                        return judge;
                    }
                });
            },
            yes: function (index, layero) {
            }
        });
    }
</script>
<!--**************************************END-考试记录部分***************************************-->
</html>